<template>
    <div :id="'preview-' + fileId" class="frame-wrap" :style="styleObj">
        <iframe :id="fileId" :src="url" frameborder="0" style="width:100%;height:100%;" scrolling="yes"></iframe>
    </div>
</template>
<script>
    export default {
        name: "docPreview",
        props: {
            id: {
                type: String
            },
            url: {
                type: String // 附件地址
            },
            height: {
                type: [String, Number],
                default: 0
            }
        },
        data() {
            return {
                fileId: "fileId-" + +new Date(), // 设置Id---->防止页面开多个组件而初始化失败！
            };
        },
        computed: {
            styleObj() {
                return {
                    height: this.height > 0 && !this.isFullscreen ? this.height + 'px' : '100%'
                }
            }
        },
        methods: {

        }
    };

</script>
<style lang="scss" scoped>
    .frame-wrap {
        position: relative;
        height: 100%;
        background: #fff;
        button {
            position: absolute;
            top: 3px;
            right: 20px;
        }
    }

</style>
